-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: major refactor of dc6 package #1
base: main
Are you sure you want to change the base?
Conversation
merge changes from gucio321/d2dc6
// Package dc6 provides a DC6 animation decoder, used by diablo 2. | ||
package dc6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we delete this file, then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure. I suppose that if there are no go package in main dir, this file isn't necessary.
It could be inside of pkg dir
Directions []*Direction | ||
palette color.Palette | ||
} | ||
Termination [terminationSize]byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these termination bytes are also artifacts of the encoding, and likely not needed in the decoded struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is, that this value isn't the same in certain dc6 files.
from documentation, we can see, that:
UBYTE termination[4]; // EE EE EE EE or CD CD CD CD
and it may be of importance for d2 game
|
||
for dir := 0; dir < d.Frames.NumberOfDirections(); dir++ { | ||
for f := 0; f < d.Frames.FramesPerDirection(); f++ { | ||
err = d.Frames.Direction(dir).Frame(f).Load(r, &d.palette) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this.
Why would you need to pass the palette in?
Why is the palette a data member of each frame?
The DC6 should only have a single palette, and the frames should not need a palette to be loaded...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please note that it is a pointer to the palette used by dc6, not palette itself.
Maybe the better solution is to add (*Frame).Palette
method to set it?
palette *color.Palette | ||
|
||
FrameData []byte | ||
Terminator []byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an artifact of the encoding, we don't need to store the termination bytes.
replace pdc6lib -> dc6lib
- replace github.com/gravestanch/bitstream with OpenDiablo2 upstream - fix broken tests
@gravestench thanks for your reviews! just fixed most of them |
Hi,
some time ago I attempted to refactor d2dc6 package (see https://github.com/gucio321/d2dc6).
In this PR i'm merging the changes, I did.
changelog:
frames
packageI hope, that these changes will make the code faster and cleaner.